#include "Weapon.h"

#include "../CommandManager.h"
#include "../Random.h"
#include "../GameObjects/World.h"

Weapon::Weapon()
	: Component("Weapon"), 
	bluntBaseDmg(0), bluntModDmg(0), 
	cutBaseDmg(0), cutModDmg(0), 
	stabBaseDmg(0), stabModDmg(0)
{
	add(CommandManager::getSingleton()->getCommand("wield"));
	add(CommandManager::getSingleton()->getCommand("sheath"));
}

Weapon::~Weapon()
{
}

int Weapon::calcDamage(DamageType dmgType)
{
	srand(World::getSingleton()->getCurrentClock());
	switch(dmgType)
	{
	case BLUNT: return Random::getSingleton()->rand(bluntModDmg) + bluntBaseDmg;
	case CUT: return Random::getSingleton()->rand(cutModDmg) + cutBaseDmg;
	case STAB: return Random::getSingleton()->rand(stabModDmg) + stabBaseDmg;
	default: return 0;
	};
}
